package com.kbbywyclient.ui.adapter;

import android.view.View;

import com.kbbywyclient.R;
import com.kbbywyclient.app.Constants;
import com.kbbywyclient.data.entity.ClerkDetailsData;
import com.kbbywyclient.ui.adapter.base.BaseAdapter;

import java.util.List;

/**
 * Created by Jiangzx on 2017/11/3 9:19.
 */

public class ClerkDetailsAdapter extends BaseAdapter<ClerkDetailsData.MonthData> {
    private int role;
    public ClerkDetailsAdapter(List<ClerkDetailsData.MonthData> data,int role) {
        super(data, R.layout.item_clerk_detail);
        this.role=role;
    }

    @Override
    public void convert(Holder holder, ClerkDetailsData.MonthData monthData, int position) {
        holder.setText(R.id.tv_date,monthData.getEvery_month());
        switch (role){
            case Constants.LEVEL_DISTRIBUTOR:
                //总代理
                holder.setText(R.id.tv_left,monthData.getInclude_num());
                holder.setText(R.id.tv_right,monthData.getSettlement_num());
                break;
            case Constants.LEVEL_FIRST:
            case Constants.LEVEL_SECOND:
                //一级、二级合伙人
                holder.setText(R.id.tv_left,monthData.getSettlement_num());
                holder.setText(R.id.tv_right,monthData.getUpper_prize_amount());
                break;
            default:
                //普通合伙人
                holder.setText(R.id.tv_left,monthData.getSettlement_num());
                holder.getView(R.id.tv_right).setVisibility(View.GONE);
                break;
        }
    }
}
